package matlap.database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectionManager {
	private static String databaseName = "jdbc:mysql://localhost/matlap_database";
	private static String userName = "root";
	private static String password = "";

	public static void initConnection() throws ClassNotFoundException {
		Class.forName("com.mysql.jdbc.Driver");
	}

	public static Connection createConnection() throws SQLException {
		// az initet itt meghivni egy if-ben, ellenorizni h mar volt-e hivva
		return DriverManager.getConnection(databaseName, userName, password);
	}

	public static void closeConnection(Connection c) throws SQLException {
		c.close();
	}
}
